/*
 * VariableAst.cpp
 *
 *  Created on: 1 Nov 2010
 *      Author: kn308
 */

#include "VariableAst.h"

namespace MAlice
{

VariableAst::VariableAst(const string& name) :
	mName(name)
{
}

VariableAst::~VariableAst()
{
}

llvm::Value* VariableAst::generate()
{
	if (Value* value = Codegen::get()->getVar(getName()))
	{
		return value;
	}

	throw runtime_error(getName() + " is not defined!");
}

}
